<extend name="Base:main" />
<block name="script">
	<link href="__PUBLIC__/seller/js/editor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="__PUBLIC__/seller/js/editor/third-party/template.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/seller/js/editor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/seller/js/editor/umeditor.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/seller/js/editor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" src="__PUBLIC__/seller/js/plupload/plupload.full.min.js"></script>
    <script src="__PUBLIC__/seller/js/calendar/WdatePicker.js"></script>
</block>
<block name="content">
    <div class="tpl-content-wrapper">
            <div class="tpl-content-page-title">
                商品管理
            </div>
            <ol class="am-breadcrumb">
                <li><a href="#" class="am-icon-home">首页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="am-active">添加商品</li>
            </ol>
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                      <div class="caption font-green bold">
                        <span class="am-icon-code"></span>添加
                    </div>
                </div>
                <div class="tpl-block ">

                    <div class="am-g tpl-amazeui-form">


                        <div class="am-u-sm-12 am-u-md-10">
                             <form class="am-form am-form-horizontal" ignoreHidden name='myfromSubmit' fun_call="call_fun_check">
                     
							 
							 <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">商品名</label>
									<div class="am-u-sm-7 float_left">
										<input type="text" name="poster[name]" id="name" datatype="*" nullmsg="商家名称不能为空" value="{$goods.name}" placeholder="商品名">
									</div>
							</div>
                            <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">EN13码</label>
									<div class="am-u-sm-5 float_left">
										<input type="text" name="poster[earn13]" id="earn13" datatype="*" nullmsg="en13码不能为空" value="{$goods.earn13}" >
									</div>
							</div>
							<div class="am-form-group">
								<label for="user-email" class="am-u-sm-3 am-form-label">商品分类</label>
								<div class="am-u-sm-5 float_left">
									<input type="hidden" id="goods_type" value="{$goods.goods_type_id}">
									<select id="goods_type_id" name="poster[goods_type_id]" class="rcol-xs-10 col-sm-5">
										<option value="0">请选择商品类别</option>
										{$select_option_list}
									</select>						 
								</div>
							</div>
                            <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">重量</label>
									<div class="am-u-sm-2 float_left">
										<input type="text" name="poster[weight]" id="weight" datatype="*" nullmsg="重量不能为空" value="{$goods.weight}" >
									</div>
									<label for="user-email" class="am-u-sm-1 am-form-label">计量单位</label>
									<div class="am-u-sm-2 float_left">
										<select name="poster[pom]" id="pom" nullmsg="计量单位不能为空" datatype="*">
											<option value="">请选择单位</option>
											<option value="件" <eq name="goods.pom" value="件">selected</eq>>件</option>
											<option value="箱" <eq name="goods.pom" value="箱">selected</eq>>箱</option>
											<option value="个" <eq name="goods.pom" value="个">selected</eq>>个</option>
											<option value="只" <eq name="goods.pom" value="只">selected</eq>>只</option>
										</select>
									</div>
							</div>
							<div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">原产地</label>
									<div class="am-u-sm-5 float_left">
										<input type="text" name="poster[place_origin]" id="place_origin" datatype="*" nullmsg="原产地不能为空" value="{$goods.place_origin}" >
									</div>
							</div>
                            <style>
								.goods_attr_list{ width:81%; float:right; display:none;}
								.goods_attr_list fieldset{ border:1px solid #ccc; width:78%;  }
								.goods_attr_list fieldset legend{ padding:3px 20px; display:block; width:auto !important;border:1px solid #ccc;  font-size:16px;}
								.goods_attr_info{ width:100%; margin-left:2%; float:left}
								.goods_attr_info dl { width:50%; float:left; font-size:14px; margin-bottom:15px !important}
								.goods_attr_info dl,.goods_attr_info dl dt,.goods_attr_info dl dd,.goods_attr_info dl dd label{margin:0px; padding:0px; font-weight:100;}
								.goods_attr_info dl dt { width:30%; float:left; vertical-align:middle; height:28px; line-height:28px; }
								.goods_attr_info dl dd { width:70%; float:left; vertical-align:middle;}
								.goods_attr_info dl dd label{ margin-right:15px; vertical-align:middle;line-height:28px;color:#666 }
								.goods_attr_info dl input[type='text'],.goods_attr_info dl select{ padding:5px 10px; width:150px;}
							</style>
                            <div class="goods_attr_list">
                                <fieldset>
                                    <legend>商品属性</legend>
                                    <div class="goods_attr_info"></div>
                                </fieldset>
                            </div>
                            <div style=" display:none;" id="gengduo_info">
                            <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">商品关键词</label>
									<div class="am-u-sm-7 float_left">
										<span>
											<input type="text" name="poster[info_keywords]" id="info_keywords"  value="{$goods.info_keywords}" >
										</span>
										<span><small>商品SEO关键字</small></span>
									</div>
							</div>
							<div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">所属品牌</label>
									<div class="am-u-sm-5 float_left">
									  <select id="goods_brand_id" name="poster[goods_brand_id]">
											<volist name="goods_brand" id="val">
												<option value="{$val['id']}"
												<if condition="$val['id'] eq $goods['goods_brand_id']">selected="selected"
												</if>
												>{$val['name']}</option>
											</volist>
										</select>
									</div>
							</div>
							<div class="am-form-group">
									<label for="user-name" class="am-u-sm-3 am-form-label">商品首图</label>
									<div class="am-u-sm-9">
                                                                              <a class="btn" id="load_uplaod" data-url="{:U('Accunt/uploadFile')}" data-name="poster[pic_thumb]" data-type="1"  data-value="{$goods.pic_thumb}">上传图片</a> 最大500KB，支持jpg，gif，png格式。 
                                                                              <ul id="ul_pics" class="ul_pics clearfix"></ul>  
									</div>
							</div>
                                                         <script type="text/javascript" src="__PUBLIC__/seller/js/upload.js"></script>
							<script> init_uploadlp('load_uplaod','ul_pics'); </script>
							<div class="am-form-group">
									<label for="user-name" class="am-u-sm-3 am-form-label">商品图片列表</label>
									<div class="am-u-sm-9">
                                                                             <a class="btn" id="load_uplaod1" data-url="{:U('Accunt/uploadFile')}" data-name="poster[pic_list]" data-type="2" data-value="{$goods.pic_list}">上传图片</a> 最大500KB，支持jpg，gif，png格式。 
                                                                              <ul id="ul_pics1" class="ul_pics clearfix"></ul> 	
									</div>
							</div>
                                                  
							<script> init_uploadlp('load_uplaod1','ul_pics1'); </script>>
							<div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">Pc端描述信息</label>
									<div class="am-u-sm-9">
										<textarea name="poster[info_pc]"  id="info_pc" placeholder="Pc端描述信息" class="col-xs-10 col-sm-5" style="height:300px;">{:htmlspecialchars_decode($goods['info_pc'])}</textarea>
										<span class="help-inline col-xs-12 col-sm-7">
											<span class="middle"></span>
										</span>
									</div>
							</div>
							<div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">移动端描述信息</label>
									<div class="am-u-sm-9">
										    <textarea name="poster[info_mobile]" id="info_mobile" placeholder="移动端描述信息" class="col-xs-10 col-sm-5" rows="5" style="height:300px;">{:htmlspecialchars_decode($goods['info_mobile'])}</textarea>
											<span class="help-inline col-xs-12 col-sm-7">
												<span class="middle"></span>
											</span>
									</div>
							</div>
							 <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">商品备注信息</label>
									<div class="am-u-sm-9">
										    <textarea name="poster[info_notice]" id="info_notice" placeholder="商品备注信息" class="col-xs-10 col-sm-5" rows="5" style="height:300px;">{:htmlspecialchars_decode($goods['info_notice'])}</textarea>
											<span class="help-inline col-xs-12 col-sm-7">
												<span class="middle"></span>
											</span>
									</div>
							</div>
                            </div>
                            
                            <div style="width:20%; margin-left:30%; text-align:center;">
                            	<a href="javascript:;" id="open_show_info">更多选填项</a>
                            </div>
                            <script>
								var index_open = 1;
								$('#open_show_info').click(function(){
									if( index_open == 1 ) {
										$('#gengduo_info').show();
										$(this).text('关闭选填项');
										index_open = 2;
										UM.getEditor('info_mobile');
										UM.getEditor('info_notice');
										UM.getEditor('info_pc');
									} else {
										UM.getEditor('info_mobile').destroy();
										UM.getEditor('info_notice').destroy();
										UM.getEditor('info_pc').destroy();
										$('#gengduo_info').hide();
										index_open = 1;
										$(this).text('更多选填项');
									}
								});
							</script>
                            <?php if( ACTION_NAME == 'add' ) : ?>
                            <fieldset>
                            	<legend>销售信息</legend>
                                <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">供应市场价</label>
                                    <div class="am-u-sm-4 float_left">
                                            <input type="text" name="distribution[market_price]" id="market_price" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="市场供应价不能为空" errormsg="市场价格格式错误"  value="" >					</div>
                                </div>
                                <div class="am-form-group">
                                        <label for="user-email" class="am-u-sm-3 am-form-label">建议销售价</label>
                                        <div class="am-u-sm-4 float_left">
                                            <input type="text" name="distribution[price]" id="price" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="建议零售价不能为空" errormsg="建议零售价格式错误"  value="" >
                                        </div>
                                </div>
								<div class="am-form-group">
										<label for="user-email" class="am-u-sm-3 am-form-label">是否支持代发</label>
										<div class="am-u-sm-8 float_left">
											<div class="tpl-switch" data-value="{$customer_setting.acting}" data-name="acting"  style="width: 50px;">
												<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn" name="distribution[sale_mode][]" value="1" <eq name="customer_setting.acting" value="1">checked</eq>>
												<div class="tpl-switch-btn-view"><div></div></div>
											</div>
										</div>
								</div>
								<span style="display:<eq name="customer_setting.acting" value="1">block<else />none</eq>;" id="acting_setting">
									<div class="am-form-group">
											<label for="user-email" class="am-u-sm-3 am-form-label">一件代发价</label>
											<div class="am-u-sm-2 float_left">
												<input type="text" name="distribution[acting_price]" id="acting_price" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="一件代发价不能为空" errormsg="一件代发价格式错误"  value="" >
											</div>
									</div>
								</span>
                                <style>
									.jiage_table_data{ width:600px;}
									.jiage_table_data td{ height:60px; background:#efefef; width:200px; } 
									.jiage_table_data .bt_j{ width:100px; font-size:12px; text-align:right;}
									.jiage_table_data span.Validform_wrong{ float:left}
									.jiage_table_data td label{ font-weight:100; font-size:14px;}
								</style>
								<div class="am-form-group">
										<label for="user-email" class="am-u-sm-3 am-form-label">是否支持锁货</label>
										<div class="am-u-sm-8 float_left">
											<div class="tpl-switch" data-name="lock" data-value="{$customer_setting.lock}" style="width: 50px;">
												<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn" name="distribution[sale_mode][]" value="2" <eq name="customer_setting.lock" value="1">checked</eq>>
												<div class="tpl-switch-btn-view"><div></div></div>
											</div>
										</div>
								</div>
								<span style="display:<eq name="customer_setting.lock" value="1">block<else />none</eq>" id="lock_setting">
									<div class="am-form-group">
											<label for="user-email" class="am-u-sm-3 am-form-label">锁货价设置</label>
											<div class="am-u-sm-8 float_left">
												<table class="jiage_table_data">
													<tr>
														<td class="bt_j" valign="middle">锁货价&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[lock_price]" id="lock_price" style="width:100px;" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="锁货价不能为空" errormsg="锁货价格式错误"  value="" ></td>
														<td class="bt_j" valign="middle">最低锁货量&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[lock_start_num]" id="lock_start_num" size="10" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="最低锁货量不能为空" errormsg="最低锁货量格式错误"  value="" ></td>
													</tr>
													<tr>
														<td class="bt_j" valign="middle">每增加&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[inc_lock_num]" id="inc_lock_num" size="10" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="增加数量不能为空" errormsg="格式错误"  value="" ></td>
														<td class="bt_j" valign="middle">单价减少&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[inc_lock_price]" id="inc_lock_price" style="width:100px;" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="增加金额不能为空" errormsg="格式错误"  value="" ></td>
													</tr>
													<tr>
														<td class="bt_j" valign="middle">最低单价&nbsp;&nbsp;&nbsp;</td>
														<td  colspan="3"><input type="text" name="distribution[lock_small_price]" id="lock_small_price" size="10" style="width:100px;" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="最低单价不能为空" errormsg="格式错误"  value="" ></td>
													</tr>
												</table>
											</div>
									</div>
									<div class="am-form-group">
											<label for="user-email" class="am-u-sm-3 am-form-label">锁货付款方式</label>
											<div class="am-u-sm-8 float_left">
												<table class="jiage_table_data">
													<tr>
														<td class="bt_j" valign="middle">类型&nbsp;&nbsp;&nbsp;</td>
														<td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" value="1" checked name="distribution[lock_pay_type]" id="pay_type_s"/> 一次付款</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" value="2" name="distribution[lock_pay_type]" id="pay_type_s"/> 两次付款</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" value="3" name="distribution[lock_pay_type]" id="pay_type_s"/> 三次付款</label></td>
													</tr>
													<tr style="display:none;">
														<td class="bt_j" valign="middle">收货支付&nbsp;&nbsp;&nbsp;</td>
														<td colspan="3"><input type="text" name="distribution[lock_pay_rule][received]" id="lock_received" maxlength="2" id="inc_lock_price" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="收货支付比例不能为空" errormsg="只能是整数"  value="" ></td>
													</tr>
													<tr style="display:none;">
														<td class="bt_j" valign="middle">锁货支付&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[lock_pay_rule][lock]" id="lock_lock" size="10" maxlength="2" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="锁货支付比例不能为空" errormsg="只能是整数"  value="" ></td>
														<td class="bt_j" valign="middle">下单支付&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[lock_pay_rule][down]" id="lock_down" size="10" style="width:100px;" maxlength="2" datatype="/^[0-9]+$/" nullmsg="下单支付比例不能为空" errormsg="只能是整数"  value="" ></td>
													</tr>
												</table>
											</div>
									</div>
								</span>
								<div class="am-form-group">
										<label for="user-email" class="am-u-sm-3 am-form-label">是否支持批发</label>
										<div class="am-u-sm-8 float_left">
											<div class="tpl-switch" data-name="wholesale" data-value="{$customer_setting.wholesale}"  style="width: 50px;">
												<input type="checkbox" class="ios-switch bigswitch tpl-switch-btn" name="distribution[sale_mode][]" value="3" <eq name="customer_setting.wholesale" value="1">checked</eq>>
												<div class="tpl-switch-btn-view"><div></div></div>
											</div>
										</div>
								</div>
								<span style="display:<eq name="customer_setting.wholesale" value="1">block<else />none</eq>" id="wholesale_setting">
									<div class="am-form-group">
											<label for="user-email" class="am-u-sm-3 am-form-label">批发价设置</label>
											<div class="am-u-sm-8 float_left">
												<table class="jiage_table_data">
													<tr>
														<td class="bt_j" valign="middle">批发价&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[wholesale_price]" id="wholesale_price" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" style="width:100px;" nullmsg="批发价不能为空" errormsg="批发价格式错误"  value="" ></td>
														<td class="bt_j" valign="middle">最低批发量&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[wholesale_start_num]" id="wholesale_start_num" datatype="/^[0-9]+$/" style="width:100px;" nullmsg="最低批发量不能为空" errormsg="最低批发量格式错误"  value="" ></td>
													</tr>
													<tr>
														<td class="bt_j" valign="middle">每增加&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[inc_wholesale_num]" id="lock_price" size="10" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="增加数量不能为空" errormsg="格式错误"  value="" ></td>
														<td class="bt_j" valign="middle">单价减少&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[inc_wholesale_price]" id="lock_start_num" style="width:100px;" size="10" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="增加金额不能为空" errormsg="格式错误"  value="" ></td>
													</tr>
													<tr>
														<td class="bt_j" valign="middle">最低单价&nbsp;&nbsp;&nbsp;</td>
														<td  colspan="3"><input type="text" name="distribution[wholesale_small_price]" id="wholesale_small_price" size="10" style="width:100px;" datatype="/^[0-9]+(\.[0-9]{1,2})?$/" nullmsg="最低单价不能为空" errormsg="格式错误"  value="" ></td>
													</tr>
												</table>
											</div>
									</div>
									<div class="am-form-group">
											<label for="user-email" class="am-u-sm-3 am-form-label">批发/代发付款方式</label>
											<div class="am-u-sm-8 float_left">
												<table class="jiage_table_data">
													<tr>
														<td class="bt_j" valign="middle">类型&nbsp;&nbsp;&nbsp;</td>
														<td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" value="1" checked name="distribution[wholesale_pay_type]" id="pay_type_s"/> 一次付款</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" value="2" name="distribution[wholesale_pay_type]" id="pay_type_s"/> 两次付款</label></td>
													</tr>
													<tr style="display:none;"></tr>
													<tr style="display:none;">
														<td class="bt_j" valign="middle">下单支付&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[wholesale_pay_rule][down]" maxlength="2" id="wholesale_down" size="10" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="下单支付比例不能为空" errormsg="只能是整数"  value="" ></td>
														<td class="bt_j" valign="middle">收货支付&nbsp;&nbsp;&nbsp;</td>
														<td><input type="text" name="distribution[wholesale_pay_rule][received]" maxlength="2" id="wholesale_received" style="width:100px;" datatype="/^[0-9]+$/" nullmsg="收货支付比例不能为空" errormsg="只能是整数"  value="" ></td>
													</tr>
												</table>
											</div>
									</div>
								</span>
                                <div class="am-form-group">
                                        <label for="user-email" class="am-u-sm-3 am-form-label">供应库存</label>
                                        <div class="am-u-sm-4 float_left">
                                            <input type="text" name="distribution[stock_num]" id="stock_num" datatype="n" nullmsg="供应库存不能为空" errormsg="供应库存必须为数字"  value="" >
                                        </div>
                                </div>
                                <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">商品库存模式</label>
                                    
									<div class="am-u-sm-9 float_left">
                                    <label class="am-radio-inline">
                                    	<input type="radio"  value="1" name="distribution[stock_status]" id="stock_status" checked> 在仓库
                                    </label>
                                    <label class="am-radio-inline">
                                    	<input type="radio" name="distribution[stock_status]" id="stock_status" value="2"> 运送途中
                                    </label>
                                    </div>
							</div>
							<div class="am-form-group" style="display:none" id="arrive_time">
									<label for="user-email" class="am-u-sm-3 am-form-label">到达时间</label>
									<div class="am-u-sm-4 float_left">
										<input type="text" name="distribution[stock_arrive_time]" id="auth_time" onfocus="WdatePicker({isShowWeek:true})" datatype="*" nullmsg="商品到达时间不能为空"  value="" >
									</div>
							</div>
                                <div class="am-form-group">
                                        <label for="user-email" class="am-u-sm-3 am-form-label">供货仓库</label>
                                        <div class="am-u-sm-4 float_left">
											<select name="distribution[warehouse_id]" datatype="*" nullmsg="请选择您需要绑定的仓库">
												<empty name="warehouse_list">
													<option value="">无仓库数据</option>
												<else />
													<volist name="warehouse_list" id="vo">
													<option value="{$vo.id}">{$vo.name}</option>
													</volist>
												</empty>
											</select>
                                        </div>
                                </div>
                                <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">供应失效类型</label>
                                    
									<div class="am-u-sm-9 float_left">
                                    <label class="am-radio-inline">
                                    	<input type="radio"  value="1" name="distribution[is_invalid_type]" id="is_invalid_type" checked> 按库存为0失效
                                    </label>
                                    <label class="am-radio-inline">
                                    	<input type="radio" name="distribution[is_invalid_type]" id="is_invalid_type" value="2"> 按时间到期失效
                                    </label>
                                    </div>
							</div>
                                <div class="am-form-group" style="display:none" id="div_invalid_time">
                                        <label for="user-email" class="am-u-sm-3 am-form-label">到期时间</label>
                                        <div class="am-u-sm-4 float_left">
                                            <input type="text" name="distribution[invalid_time]" id="invalid_time" onfocus="WdatePicker({isShowWeek:true})" datatype="*" nullmsg="商品失效时间不能为空"  value="" >
                                        </div>
                                </div>
                                 <div class="am-form-group">
                                                <label for="user-name" class="am-u-sm-3 am-form-label">资料上传</label>
                                                <div class="am-u-sm-9">
                                               
                                                    <a class="btn" id="information" data-url="{:U('Accunt/uploadFile')}" data-name="poster[information]" data-type="1"  data-value="{$goods.pic_thumb}">上传图片</a> 最大500KB，支持jpg，gif，png格式。 
                                                    <ul id="ul_pics2" class="ul_pics clearfix"></ul>  
                                              </div>
                              </div>
                               <script type="text/javascript" src="__PUBLIC__/seller/js/upload.js"></script>
                              <script> init_uploadlp('information','ul_pics2'); </script>
                            </fieldset>
                            <?php endif; ?>
							
							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<button type="submit" class="am-btn am-btn-primary">保存修改</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>

		</div>

        </div>
<script type="text/javascript">
		function checked_small_data( obj ) {
			error('信息不能为空');
			return false;
		}
		$('div.tpl-switch').click(function(){
			var data = $(this).attr('data-value') == 1 ? 0 : 1;
			data == 1 ? $("#" + $(this).attr('data-name') + "_setting").show() : $("#" + $(this).attr('data-name') + "_setting").hide();
			$(this).attr('data-value' , data);
		});

        var goods_type_id = $('#goods_type').val();
        if(goods_type_id){
			$('#goods_type_id option').each(function(){
				if( goods_type_id == $(this).attr('value') ) {
					$(this).attr('selected' , true);
					return false;
				} 
			}); 
			$.get(getUrl('goods/goodsCatAttrList',{ 'category_id':goods_type_id,'goods_id':'{$goods.id}' }) , function( data ){
				if( data.status == 1 ) {
						$('.goods_attr_info').html( data.info );
						$('.goods_attr_list').show();
				} else {
						clearAttr();
				}
			}, 'json');
        }
		$('input#is_invalid_type').click(function(){
			if($(this).val() == 2 ) {
				$('#div_invalid_time').show();
			} else {
				$('#div_invalid_time').hide();
			}
		});
		$('input#stock_status').click(function(){
			if($(this).val() == 2 ) {
				$('#arrive_time').show();
			} else {
				$('#arrive_time').hide();
			}
		});
                
		$('#goods_type_id').change(function(){
			if( $(this).val() != '' ) {
					$.get(getUrl('goods/goodsCatAttrList',{'category_id':$(this).val()}) , function( data ){
						if( data.status == 1 ) {
								$('.goods_attr_info').html( data.info );
								$('.goods_attr_list').show();
						} else {
								clearAttr();
						}
					}, 'json');
			} else {
					clearAttr();
			}
		});
		
		function clearAttr() {
			$('.goods_attr_info').html('');
			$('.goods_attr_list').hide();
		}
		$('input#pay_type_s').click(function(){
			var _self = $(this).closest('tr');
			if( $(this).val() == 2 ) {
					_self.next().next().show();
					_self.next().hide();
			} else if( $(this).val() == 3 ) {
					_self.next().show();
					_self.next().next().show();
			} else {
					_self.next().hide();
					_self.next().next().hide();
			}
		});
		
		function call_fun_check() {
			var flag_index = false;
			$('div.tpl-switch').each(function(){
				if( $(this).attr('data-value') == 1 ) {
					flag_index = true;
				}
			});
			
			if( flag_index === false ) {
				error('必须选择一种销售模式');
				return false;
			}
		
			var lock_down = $('#lock_down').val();
			var lock_lock = $('#lock_lock').val();
			var lock_received = $('#lock_received').val();
			var wholesale_down = $('#wholesale_down').val();
			var wholesale_received = $('#wholesale_received').val();
			if( $('input[name="distribution[lock_pay_type]"]:checked').val() == '2' ) {
				if( parseInt( lock_down ) + parseInt( lock_lock ) != 100 ) {
					error('锁货支付比例总和必须为100！');
					return false;
				}
			} else if( $('input[name="distribution[lock_pay_type]"]:checked').val() == '3' ) {
				if( parseInt( lock_down ) + parseInt( lock_received ) + parseInt( lock_lock ) != 100 ) {
					error('锁货支付比例总和必须为100！');
					return false;
				}
			}
			if( $('input[name="distribution[wholesale_pay_type]"]:checked').val() == '2' ) {
				if( parseInt( wholesale_down ) + parseInt( wholesale_received ) != 100 ) {
					error('批发/代发支付比例总和必须为100！');
					return false;
				}
			}
		}
 $("#goods_brand_id").comboSelect();
        $("#goods_type_id").comboSelect();
</script>
</block>